package vip.liux.gateway.filters.decrypt;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * 配置决定使用哪种 AppKeyRepository 实现
 */
@ConfigurationProperties(prefix = "gateway.app-key-repository")
public class AppKeyRepositoryProperties {

    /**
     * 可选项: memory, redis, redis-hash
     * 配置示例:
     * gateway:
     * app-key-repository:
     * type: memory
     */
    private Type type = Type.MEMORY; // 默认memory

    private Map<String, KeyPairConfig> apps = new HashMap<>();

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public Map<String, KeyPairConfig> getApps() {
        return apps;
    }

    public void setApps(Map<String, KeyPairConfig> apps) {
        this.apps = apps;
    }

    public enum Type {
        MEMORY, REDIS_HASH
    }
}